#!/bin/bash

# Conan output directory
conan_target="Targets/ConanFiles/$1"

# CMake output directory
build_target="Targets/$1"

# Activate python environment
source ~/empy/bin/activate

# Install conan dependencies
conan install . --install-folder $conan_target --build missing -s build_type=$1 -c tools.system.package_manager:sudo=True -c tools.system.package_manager:mode=install

# Generate cmake build files
cmake -S . -B $build_target -DCMAKE_BUILD_TYPE=$1 -DCMAKE_TOOLCHAIN_FILE="$conan_target/conan_toolchain.cmake"

# Compile cmake build files
cmake --build $build_target --config $1
